<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/

//allowed symbols
//$config['allowed_symbols']='_-';
//$config['disallowed_symbols']='\'"';


function help_me()
{
    echo "\nIm a helper function\n";
}

function include_me($path,$arr=NULL,$load=FALSE)
{

    //$path="folder1/folder2/myname";
    if(!empty($arr))
        extract($arr);

    /*$filename = strtolower($path) ;
    $path_arr = split("[/\]", $filename) ;
    //print_r($path);
    $n = count($path_arr)-1;
    $filename = $path_arr[$n];

    $exts = split("[/\\.]", $filename) ;
    //print_r($exts);
    $n = count($exts)-1;
    //$exts = $exts[$n];
    if($n==0)
        $path.=".php";*/

    $path_parts = pathinfo($path);
    /*print_r($path_parts);
echo $path_parts['dirname'], "<br />";
echo $path_parts['basename'], "<br />";
echo $path_parts['extension'], "<br />";
echo $path_parts['filename'], "<br />"; // since PHP 5.2.0
echo $path;    include "app/view/$path";*/
    if(!isset($path_parts['extension']))
        $filename="app/view/$path.php";
    else
        $filename="app/view/$path";
    
    ob_start();
    include_once $filename;
    $contents = ob_get_contents();
    ob_end_clean();

    if($load)
        return $contents;
    else
        echo $contents;


}

function __autoload($class)
{
    //echo $class;
    if(file_exists("app/controller/$class.php"))
        include "app/controller/$class.php";
    else
    {
        echo '404 controller error';
        die;
    }


}

?>
